package com.ruoyi.teach.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.teach.domain.NbChapterVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.teach.mapper.NbChapterMapper;
import com.ruoyi.teach.domain.NbChapter;
import com.ruoyi.teach.service.INbChapterService;

/**
 * 章节Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-12-08
 */
@Service
public class NbChapterServiceImpl implements INbChapterService 
{
    @Autowired
    private NbChapterMapper nbChapterMapper;

    /**
     * 查询章节
     * 
     * @param id 章节主键
     * @return 章节
     */
    @Override
    public NbChapter selectNbChapterById(Long id)
    {
        return nbChapterMapper.selectNbChapterById(id);
    }

    /**
     * 查询章节列表
     * 
     * @param nbChapter 章节
     * @return 章节
     */
    @Override
    public List<NbChapter> selectNbChapterList(NbChapter nbChapter)
    {
        return nbChapterMapper.selectNbChapterList(nbChapter);
    }
    /**
     * 查询章节树
     *
     * @param nbChapter 章节
     * @return 章节集合
     */
    @Override
    public List<NbChapter> selectNbChapterTree(NbChapter nbChapter) {
        return nbChapterMapper.selectNbChapterTree(nbChapter);
    }

    /**
     * 新增章节
     * 
     * @param nbChapter 章节
     * @return 结果
     */
    @Override
    public int insertNbChapter(NbChapter nbChapter)
    {
        nbChapter.setCreateTime(DateUtils.getNowDate());
        return nbChapterMapper.insertNbChapter(nbChapter);
    }

    /**
     * 修改章节
     * 
     * @param nbChapter 章节
     * @return 结果
     */
    @Override
    public int updateNbChapter(NbChapter nbChapter)
    {
        nbChapter.setUpdateTime(DateUtils.getNowDate());
        return nbChapterMapper.updateNbChapter(nbChapter);
    }

    /**
     * 批量删除章节
     * 
     * @param ids 需要删除的章节主键
     * @return 结果
     */
    @Override
    public int deleteNbChapterByIds(Long[] ids)
    {
        return nbChapterMapper.deleteNbChapterByIds(ids);
    }

    /**
     * 删除章节信息
     * 
     * @param id 章节主键
     * @return 结果
     */
    @Override
    public int deleteNbChapterById(Long id)
    {
        return nbChapterMapper.deleteNbChapterById(id);
    }
}
